	// Extract the object we're interested in from the list response.
	itemsList_ := res["<%= object.self_link_query.items -%>"]
	var itemsList []interface{}
	if itemsList_ != nil {
		itemsList = itemsList_.([]interface{})
	}
	listObj := make([]map[string]interface{}, len(itemsList))
	for i, item := range itemsList {
		listObj[i] = item.(map[string]interface{})
	}
	res = nil
	for _, item := range listObj {
	<% object.identity.each do |prop| -%>
		<% if settable_properties.include?(prop) -%>
		this<%= titlelize_property(prop) -%>, err := expand<%= resource_name -%><%= titlelize_property(prop) -%>(d.Get("<%= prop.name.underscore -%>"), d, config)
		if err != nil {
			return err
		}
		<% else -%>
			this<%= titlelize_property(prop) -%> := d.Get("<%= prop.name.underscore -%>")
		<% end -%>
		that<%= titlelize_property(prop) -%> := flatten<%= resource_name -%><%= titlelize_property(prop) -%>(item["<%= prop.api_name -%>"], d, config)
		log.Printf("[DEBUG] Checking equality of %#v, %#v", that<%= titlelize_property(prop) -%>, this<%= titlelize_property(prop) -%>)
		if !reflect.DeepEqual(that<%= titlelize_property(prop) -%>, this<%= titlelize_property(prop) -%>) {
			continue
		}
	<% end -%>
		res = item
		break
	}
	if res == nil {
		// Object isn't there any more - remove it from the state.
		log.Printf("[DEBUG] Removing <%= resource_name -%> because it couldn't be matched.")
		d.SetId("")
		return nil
	}

